// Qt on Metro plugin
// Copyright (c) Andrew Knight
// This software is licensed under the MIT: http://www.opensource.org/licenses/MIT
// This software uses Qt (http://qt.nokia.com)

#ifndef METROAPPLICATION_H
#define METROAPPLICATION_H

#include <QtCore/QObject>
#include <QtCore/QThread>
#include <QtGui/QImage>
#include <QtGui/QPainter>
#include <QtGui/QGraphicsScene>
#include <QtDeclarative/QDeclarativeEngine>
#include <QtDeclarative/QDeclarativeContext>
#include <QtDeclarative/QDeclarativeItem>
#include <QtGui/QMouseEvent>

class MetroApplication : public QObject//, MetroInterface
{
    Q_OBJECT
    //Q_INTERFACES(MetroInterface)

public:

    enum LayoutState {
        Fullscreen,
        Filled,
        Snapped
    };

    MetroApplication();
    void resize(const QSize size);
    void changeLayout(const LayoutState layout);
    void render();
    //const uchar* imageData();
    const QImage image();
    bool event(QEvent *);
    void start();
    //void run();

    //QGraphicsScene* scene();

protected:
    //void timerEvent(QTimerEvent *);

private:
    QGraphicsScene m_scene;
    QImage m_image;
    QPainter m_painter;
    Qt::MouseButton m_lastMouseDownButton;
    QPoint m_lastMouseDownPos;
    QPoint m_lastMousePos;
    QDeclarativeEngine m_engine;
    QDeclarativeContext m_context;
    QDeclarativeItem* m_rootItem;
    LayoutState m_layoutState;
};

#endif // METROAPPLICATION_H
